package com.codegenerate.demo.dto; /**
========= dto ==========
*/

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.codegenerate.demo.config.R;
import com.codegenerate.demo.entity.AppFun;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.time.LocalDateTime;

public class AppFunDto implements Serializable {
  private long id;

    int pageNum;
     int pageSize;
     String funTypes;

    public String getFunTypes() {
        return funTypes;
    }

    public void setFunTypes(String funTypes) {
        this.funTypes = funTypes;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

   public R validateUpdate(){
        if(this.getId()<0){
                   return R.failed("id 不能为空");
          }
        return R.ok(null);
    }


   

  
        
            /**
            * 最近更新时间
            */
            private LocalDateTime lastEditTime;
        

   
        
            /**
            * 最近更新人ID
            */
            private long editUserId;
        

   
        
            /**
            * 添加时间
            */
            private LocalDateTime addTime;
        

   
        
            /**
            * 添加人
            */
            private String addUser;
        

   
        
            /**
            * 有效状态[数据字典=del_state] 1有效  5删除
            */
            private long delState;
        

   
        
            /**
            * 所有分类路径
            */
            private String parentIdPath;
        

   
        
            /**
            * 功能地址[查询]
            */
            private String funUrl;
        

   
        
            /**
            * 服务器编号ID
            */
            private long serverNumber;
        

   
        
            /**
            * 最近更新人
            */
            private String editUser;
        

   
        
            /**
            * 添加人ID
            */
            private long addUserId;
        

   
        
            /**
            * 当前状态[查询] 1开启  5关闭  
            */
            private long state;
        

   
        
            /**
            * 排序号
            */
            private long orderNum;
        

   
        
            /**
            * 分类图片[查询]
            */
            private String img;
        

   
        
            /**
            * 功能深度[查询]
            */
            private long deep;
        

   
        
            /**
            * 所属上级类别[关系=SysClass]
            */
            private long parentId;
        

   
        
            /**
            * 移动端功能地址
            */
            private String mobileUrl;
        

   
        
            /**
            * 移动端应用状态
            */
            private long mobileState;
        

   
        
            /**
            * 所属者类型[数据字典=OwnerType]0应用功能1管理员追加功能2用户追加功能
            */
            private long ownerType;
        

   
        
            /**
            * 功能类型[数据字典=FunType]1内部功能2外部功能
            */
            private long funScope;
        

   
        
            /**
            * 功能类型[数据字典=FunType] 1栏目 2功能  3按钮 
            */
            private long funType;
        

   
        
            /**
            * 功能名称[查询]
            */
            private String name;
        

   
        
            /**
            * 所属应用[关系=AppInfo]
            */
            private long appId;
        

   
        
        

   





    
           public LocalDateTime getLastEditTime() {
             return lastEditTime;
          }
          public void setLastEditTime(LocalDateTime lastEditTime) {
                 this.lastEditTime = lastEditTime;
          }   
   
           public long getEditUserId() {
             return editUserId;
          }
          public void setEditUserId(long editUserId) {
                 this.editUserId = editUserId;
          }   
   
           public LocalDateTime getAddTime() {
             return addTime;
          }
          public void setAddTime(LocalDateTime addTime) {
                 this.addTime = addTime;
          }   
   
           public String getAddUser() {
             return addUser;
          }
          public void setAddUser(String addUser) {
                 this.addUser = addUser;
          }   
   
           public long getDelState() {
             return delState;
          }
          public void setDelState(long delState) {
                 this.delState = delState;
          }   
   
           public String getParentIdPath() {
             return parentIdPath;
          }
          public void setParentIdPath(String parentIdPath) {
                 this.parentIdPath = parentIdPath;
          }   
   
           public String getFunUrl() {
             return funUrl;
          }
          public void setFunUrl(String funUrl) {
                 this.funUrl = funUrl;
          }   
   
           public long getServerNumber() {
             return serverNumber;
          }
          public void setServerNumber(long serverNumber) {
                 this.serverNumber = serverNumber;
          }   
   
           public String getEditUser() {
             return editUser;
          }
          public void setEditUser(String editUser) {
                 this.editUser = editUser;
          }   
   
           public long getAddUserId() {
             return addUserId;
          }
          public void setAddUserId(long addUserId) {
                 this.addUserId = addUserId;
          }   
   
           public long getState() {
             return state;
          }
          public void setState(long state) {
                 this.state = state;
          }   
   
           public long getOrderNum() {
             return orderNum;
          }
          public void setOrderNum(long orderNum) {
                 this.orderNum = orderNum;
          }   
   
           public String getImg() {
             return img;
          }
          public void setImg(String img) {
                 this.img = img;
          }   
   
           public long getDeep() {
             return deep;
          }
          public void setDeep(long deep) {
                 this.deep = deep;
          }   
   
           public long getParentId() {
             return parentId;
          }
          public void setParentId(long parentId) {
                 this.parentId = parentId;
          }   
   
           public String getMobileUrl() {
             return mobileUrl;
          }
          public void setMobileUrl(String mobileUrl) {
                 this.mobileUrl = mobileUrl;
          }   
   
           public long getMobileState() {
             return mobileState;
          }
          public void setMobileState(long mobileState) {
                 this.mobileState = mobileState;
          }   
   
           public long getOwnerType() {
             return ownerType;
          }
          public void setOwnerType(long ownerType) {
                 this.ownerType = ownerType;
          }   
   
           public long getFunScope() {
             return funScope;
          }
          public void setFunScope(long funScope) {
                 this.funScope = funScope;
          }   
   
           public long getFunType() {
             return funType;
          }
          public void setFunType(long funType) {
                 this.funType = funType;
          }   
   
           public String getName() {
             return name;
          }
          public void setName(String name) {
                 this.name = name;
          }   
   
           public long getAppId() {
             return appId;
          }
          public void setAppId(long appId) {
                 this.appId = appId;
          }   
   
           public long getId() {
             return id;
          }
          public void setId(long id) {
                 this.id = id;
          }   
   

 

        /**
        * build
        */
       public static AppFunDto build(){
            AppFunDto temp = new AppFunDto();


            
                  temp.setLastEditTime(LocalDateTime.now());
            
                  temp.setEditUserId(0L);
            
                  temp.setAddTime(LocalDateTime.now());
            
                  temp.setAddUser("");
            
                  temp.setDelState(1);
            
                  temp.setParentIdPath("");
            
                  temp.setFunUrl("");
            
                  temp.setServerNumber(0L);
            
                  temp.setEditUser("");
            
                  temp.setAddUserId(0L);
            
                  temp.setState(0L);
            
                  temp.setOrderNum(0L);
            
                  temp.setImg("");
            
                  temp.setDeep(0L);
            
                  temp.setParentId(0L);
            
                  temp.setMobileUrl("");
            
                  temp.setMobileState(0L);
            
                  temp.setOwnerType(0L);
            
                  temp.setFunScope(0L);
            
                  temp.setFunType(0L);
            
                  temp.setName("");
            
                  temp.setAppId(0L);
            
                  temp.setId(0L);
            

            return temp;
    }

    /**
        * setDefaultValue
        */
       public void  setDefaultValue(AppFunDto temp){
            
                    if(null==this.lastEditTime){
                                temp.setLastEditTime(LocalDateTime.now());
                    }        
            
                    if(this.editUserId<=0){
                                temp.setEditUserId(0L);
                    }        
            
                    if(null==this.addTime){
                                temp.setAddTime(LocalDateTime.now());
                    }        
            
                    if(StringUtils.isEmpty(this.addUser)){
                                temp.setAddUser("");
                    }        
            
                    if(this.delState<=0){
                                temp.setDelState(1);
                    }        
            
                    if(StringUtils.isEmpty(this.parentIdPath)){
                                temp.setParentIdPath("");
                    }        
            
                    if(StringUtils.isEmpty(this.funUrl)){
                                temp.setFunUrl("");
                    }        
            
                    if(this.serverNumber<=0){
                                temp.setServerNumber(0L);
                    }        
            
                    if(StringUtils.isEmpty(this.editUser)){
                                temp.setEditUser("");
                    }        
            
                    if(this.addUserId<=0){
                                temp.setAddUserId(0L);
                    }        
            
                    if(this.state<=0){
                                temp.setState(0L);
                    }        
            
                    if(this.orderNum<=0){
                                temp.setOrderNum(0L);
                    }        
            
                    if(StringUtils.isEmpty(this.img)){
                                temp.setImg("");
                    }        
            
                    if(this.deep<=0){
                                temp.setDeep(0L);
                    }        
            
                    if(this.parentId<=0){
                                temp.setParentId(0L);
                    }        
            
                    if(StringUtils.isEmpty(this.mobileUrl)){
                                temp.setMobileUrl("");
                    }        
            
                    if(this.mobileState<=0){
                                temp.setMobileState(0L);
                    }        
            
                    if(this.ownerType<=0){
                                temp.setOwnerType(0L);
                    }        
            
                    if(this.funScope<=0){
                                temp.setFunScope(0L);
                    }        
            
                    if(this.funType<=0){
                                temp.setFunType(0L);
                    }        
            
                    if(StringUtils.isEmpty(this.name)){
                                temp.setName("");
                    }        
            
                    if(this.appId<=0){
                                temp.setAppId(0L);
                    }        
            
                    if(this.id<=0){
                                temp.setId(0L);
                    }        
            
    }



    /**
        * dto2entity
        */
       public AppFun dto2entity(){
            var entity=AppFun.build();
            
                    if(null!=this.lastEditTime){
                       entity.setLastEditTime(this.getLastEditTime());
                    }        
            
                    if(this.editUserId>0){
                       entity.setEditUserId(this.getEditUserId());
                    }        
            
                    if(null!=this.addTime){
                       entity.setAddTime(this.getAddTime());
                    }        
            
                    if(!StringUtils.isEmpty(this.addUser)){
                       entity.setAddUser(this.getAddUser());
                    }        
            
                    if(this.delState>0){
                       entity.setDelState(this.getDelState());
                    }        
            
                    if(!StringUtils.isEmpty(this.parentIdPath)){
                       entity.setParentIdPath(this.getParentIdPath());
                    }        
            
                    if(!StringUtils.isEmpty(this.funUrl)){
                       entity.setFunUrl(this.getFunUrl());
                    }        
            
                    if(this.serverNumber>0){
                       entity.setServerNumber(this.getServerNumber());
                    }        
            
                    if(!StringUtils.isEmpty(this.editUser)){
                       entity.setEditUser(this.getEditUser());
                    }        
            
                    if(this.addUserId>0){
                       entity.setAddUserId(this.getAddUserId());
                    }        
            
                    if(this.state>0){
                       entity.setState(this.getState());
                    }        
            
                    if(this.orderNum>0){
                       entity.setOrderNum(this.getOrderNum());
                    }        
            
                    if(!StringUtils.isEmpty(this.img)){
                       entity.setImg(this.getImg());
                    }        
            
                    if(this.deep>0){
                       entity.setDeep(this.getDeep());
                    }        
            
                    if(this.parentId>0){
                       entity.setParentId(this.getParentId());
                    }        
            
                    if(!StringUtils.isEmpty(this.mobileUrl)){
                       entity.setMobileUrl(this.getMobileUrl());
                    }        
            
                    if(this.mobileState>0){
                       entity.setMobileState(this.getMobileState());
                    }        
            
                    if(this.ownerType>0){
                       entity.setOwnerType(this.getOwnerType());
                    }        
            
                    if(this.funScope>0){
                       entity.setFunScope(this.getFunScope());
                    }        
            
                    if(this.funType>0){
                       entity.setFunType(this.getFunType());
                    }        
            
                    if(!StringUtils.isEmpty(this.name)){
                       entity.setName(this.getName());
                    }        
            
                    if(this.appId>0){
                       entity.setAppId(this.getAppId());
                    }        
            
                    if(this.id>0){
                       entity.setId(this.getId());
                    }
           if(StringUtils.isEmpty(this.funTypes)){
               entity.setFunTypes(this.getFunTypes());
           }

           return entity;
        }

        

    public Page<AppFun> buildPage(){
            Page<AppFun> tempage = new Page<AppFun>();
            tempage.setCurrent(this.getPageNum()<=0?0:this.getPageNum());
            tempage.setSize(this.getPageSize()<=0?10:this.getPageSize());
            return tempage;
     }


}